library(tidyverse)
library(readxl)
path <- "Excel/900-999/901/901 First 10 Odd Numbers.xlsx"
test <- read_excel(path, range = "A1:A101") %>% pull() %>% as.numeric()
res <- seq(101, 1e7, 2) |>
tibble(n = _) |>
mutate(
f = as.integer(str_sub(n, 1, 1)),
l = as.integer(str_sub(n, -1))
) |>
filter(
f != l,
f != 0,
l != 0,
paste0(f, l) != "01",
n %% as.integer(paste0(f, l)) == 0,
n %% as.integer(paste0(l, f)) == 0
) |>
slice_head(n = 100) |>
pull(n)
all.equal(res, test)
#[1] TRUEExcel BI - Excel Challenge 901
excel-challenges
excel-formulas
🔰 Find the first 100 ODD numbers > 99 where number is perfectly divisible by combination of first and last digit and also by combination of last and first digit.

Challenge Description
🔰 Find the first 100 ODD numbers > 99 where number is perfectly divisible by combination of first and last digit and also by combination of last and first digit.
Solutions
- Logic: Read the workbook ranges needed for the challenge; Derive the required intermediate columns.
- Strengths: The code maps the workbook rule into a compact, reproducible pipeline.
- Areas for Improvement: The solution assumes the workbook layout and selected ranges remain stable, so any structural change in the sheet would require small adjustments.
- Gem: The elegant part is how little code is needed once the correct intermediate representation is chosen.
import pandas as pd
path = "Excel\\900-999\\901\\901 First 10 Odd Numbers.xlsx"
test = pd.read_excel(path, usecols='A', nrows = 101)
res = []
n = 101
while len(res) < 100:
if n % 2:
s = str(n)
f, l = int(s[0]), int(s[-1])
if f != l and f != 0 and l != 0 and s[0] + s[-1] != "01":
a = int(s[0] + s[-1])
b = int(s[-1] + s[0])
if n % a == 0 and n % b == 0:
res.append(n)
n += 2
print(res == test['Answer Expected'].tolist()) # TrueThe Python version keeps the algorithm explicit, which helps when the challenge depends on a greedy or iterative rule.
Difficulty Level
Easy / Medium
The business rule is clear, though the workbook still needs a few transformation steps to reach the expected output.